class_name  BaseSand
extends Sprite2D

func random_gems():
	pass

func _ready() -> void:
	pass


func mark_rect():
	var rect = self.global_transform * get_rect()
	CellManager.add_rect(rect)

func add_sub_viewport():
	var rect = self.global_transform * get_rect()
	var sub_view = SubViewport.new()
	sub_view.size = rect.size
	sub_view.render_target_clear_mode = SubViewport.CLEAR_MODE_NEVER
	sub_view.render_target_update_mode = SubViewport.UPDATE_WHEN_PARENT_VISIBLE
	
	var sub_camera = Camera2D.new()
	sub_camera.anchor_mode = Camera2D.ANCHOR_MODE_FIXED_TOP_LEFT
	sub_camera.position = rect.position
	sub_camera.enabled = true
	sub_view.add_child(sub_camera)
	add_child(sub_view)
	return sub_view
